# use third libs
include(FetchContent)

# eigen
message("Downlaod eigen from https://gitee.com/bt-server/eigen.git")
FetchContent_Declare(
  eigen
  GIT_REPOSITORY https://gitee.com/bt-server/eigen.git
  SOURCE_DIR ${THIRD_LIB}/eigen
  GIT_SHALLOW    TRUE # 不拉取完整历史，相当于`git clone --depth=1`
  )

FetchContent_GetProperties(eigen)
if (NOT eigen_POPULATED)
  FetchContent_Populate(eigen)
endif ()

macro(use_eigen ag_project_name)
  target_compile_definitions(${ag_project_name} PRIVATE USE_LIB_EIGEN)
  # include eigen_SOURCE_DIR ==> eigen
  target_include_directories(${ag_project_name} PRIVATE ${eigen_SOURCE_DIR})
endmacro(use_eigen)